<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>plane3.m</title>
<link rel="stylesheet" type="text/css" href="../../m-syntax.css">
</head>
<body>
<code>
<span class=defun_kw>function</span>&nbsp;<span class=defun_out>varargout</span>=<span class=defun_name>plane3</span>(<span class=defun_in>arg1,arg2</span>)<br>
<span class=h1>%&nbsp;PLANE3&nbsp;Plots&nbsp;plane&nbsp;in&nbsp;3d.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>%&nbsp;&nbsp;h=plane3(&nbsp;W,&nbsp;b&nbsp;)</span><br>
<span class=help>%&nbsp;&nbsp;h=plane3(&nbsp;model&nbsp;)</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>%&nbsp;&nbsp;h=plane3(&nbsp;W,&nbsp;b&nbsp;)&nbsp;plots&nbsp;the&nbsp;plane&nbsp;described&nbsp;as</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;W'*x&nbsp;+&nbsp;b&nbsp;=&nbsp;0.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;&nbsp;h=plane3(&nbsp;model&nbsp;)&nbsp;structure&nbsp;model&nbsp;contains&nbsp;plane&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;parametres&nbsp;W&nbsp;and&nbsp;b.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>%&nbsp;&nbsp;h&nbsp;[1&nbsp;x&nbsp;nobjects]&nbsp;Handles&nbsp;of&nbsp;used&nbsp;graphical&nbsp;objects.</span><br>
<span class=help>%</span><br>
<hr>
<span class=help1>%&nbsp;<span class=help1_field>About:</span>&nbsp;Statistical&nbsp;Pattern&nbsp;Recognition&nbsp;Toolbox</span><br>
<span class=help1>%&nbsp;(C)&nbsp;1999-2003,&nbsp;Written&nbsp;by&nbsp;Vojtech&nbsp;Franc&nbsp;and&nbsp;Vaclav&nbsp;Hlavac</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.cvut.cz"&gt;Czech&nbsp;Technical&nbsp;University&nbsp;Prague&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.feld.cvut.cz"&gt;Faculty&nbsp;of&nbsp;Electrical&nbsp;Engineering&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://cmp.felk.cvut.cz"&gt;Center&nbsp;for&nbsp;Machine&nbsp;Perception&lt;/a&gt;</span><br>
<br>
<span class=help1>%&nbsp;<span class=help1_field>Modifications:</span></span><br>
<span class=help1>%&nbsp;17-may-2004,&nbsp;VF</span><br>
<span class=help1>%&nbsp;13-apr-2003,&nbsp;VF</span><br>
<span class=help1>%&nbsp;11-aug-2003,&nbsp;VF</span><br>
<br>
<hr>
<span class=keyword>if</span>&nbsp;isstruct(arg1),<br>
&nbsp;&nbsp;W&nbsp;=&nbsp;arg1.W;<br>
&nbsp;&nbsp;b&nbsp;=&nbsp;arg1.b;<br>
&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;<span class=stack>nargin</span>&nbsp;&gt;=&nbsp;2,&nbsp;col&nbsp;=&nbsp;arg2;&nbsp;<span class=keyword>else</span>&nbsp;col&nbsp;=&nbsp;<span class=quotes>'g'</span>;&nbsp;<span class=keyword>end</span><br>
<span class=keyword>else</span><br>
&nbsp;&nbsp;W&nbsp;=&nbsp;arg1;<br>
&nbsp;&nbsp;b&nbsp;=&nbsp;arg2;<br>
&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;<span class=stack>nargin</span>&nbsp;&gt;=&nbsp;3,&nbsp;col&nbsp;=&nbsp;arg3;&nbsp;<span class=keyword>else</span>&nbsp;col&nbsp;=&nbsp;<span class=quotes>'g'</span>;&nbsp;<span class=keyword>end</span><br>
<span class=keyword>end</span><br>
<br>
ax=<span class=graph>axis</span>;<br>
<br>
A=[ax(1)&nbsp;ax(3)];<br>
B=[ax(2)&nbsp;ax(3)];<br>
C=[ax(2)&nbsp;ax(4)];<br>
D=[ax(1)&nbsp;ax(4)];<br>
<br>
W=W(:);<br>
<br>
A=[A,&nbsp;-(b&nbsp;+&nbsp;A*W(1:2))/W(3)];<br>
B=[B,&nbsp;-(b&nbsp;+&nbsp;B*W(1:2))/W(3)];<br>
C=[C,&nbsp;-(b&nbsp;+&nbsp;C*W(1:2))/W(3)];<br>
D=[D,&nbsp;-(b&nbsp;+&nbsp;D*W(1:2))/W(3)];<br>
&nbsp;&nbsp;<br>
X=[A(1)&nbsp;B(1)&nbsp;C(1)&nbsp;D(1)];<br>
Y=[A(2)&nbsp;B(2)&nbsp;C(2)&nbsp;D(2)];<br>
Z=[A(3)&nbsp;B(3)&nbsp;C(3)&nbsp;D(3)];<br>
<br>
h=patch(X,Y,Z,col);<br>
<span class=graph>set</span>(h,<span class=quotes>'faceAlpha'</span>,0.5);<br>
<br>
<span class=keyword>if</span>&nbsp;<span class=stack>nargout</span>&nbsp;&gt;=&nbsp;1,&nbsp;<span class=stack>varargout</span>{1}&nbsp;=&nbsp;h;&nbsp;<span class=keyword>end</span><br>
<br>
<span class=jump>return</span>;<br>
<span class=comment>%&nbsp;EOF</span><br>
</code>
